﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace HangerSupport
{
	public partial class DlgHSLabelSet : System.Windows.Forms.Form
	{
		private void DlgHSLabelSet_FormClosed(object sender, FormClosedEventArgs e)
		{
			DlgHSLabelSet.g_Dlg_X = base.Location.X;
			DlgHSLabelSet.g_Dlg_Y = base.Location.Y;
		}

		public DlgHSLabelSet()
		{
			this.InitializeComponent();
			YJKProcessTools hyprocessTools = new YJKProcessTools();
			hyprocessTools.ShowInTaskbarChange(this);
			base.Location = new System.Drawing.Point(DlgHSLabelSet.g_Dlg_X, DlgHSLabelSet.g_Dlg_Y);
			this.comboPos.Items.Add("不显示");
			this.comboPos.Items.Add("左");
			this.comboPos.Items.Add("右");
			this.comboPos.Items.Add("上");
			this.comboPos.Items.Add("下");
			this.comboPos.Items.Add("中");
			this.comboViewType.Items.Add("1");
			this.comboViewType.Items.Add("01");
			this.comboViewType.Items.Add("001");
			this.comboViewType.Items.Add("0001");
			this.comboViewType.Items.Add("00001");
			this.SetInitInfo();
		}

		public DlgHSLabelSet(Label_Define def) : this()
		{
			YJKProcessTools hyprocessTools = new YJKProcessTools();
			hyprocessTools.ShowInTaskbarChange(this);
			this.m_labelDef = def;
			this.SetInitInfo();
		}

		public void SetInitInfo()
		{
			this.textLabelNo.Text = this.m_labelDef.m_strNo;
			this.textPre.Text = this.m_labelDef.m_strPre;
			this.comboPos.SelectedIndex = this.m_labelDef.m_nPosType;
			bool flag = this.m_labelDef.m_nPosType == 0;
			if (flag)
			{
				this.comboPos.SelectedIndex = 4;
			}
			this.comboViewType.SelectedIndex = this.m_labelDef.m_strTypeView.Length - 1;
		}

		public bool GetInfo()
		{
			string text = this.textLabelNo.Text;
			bool flag = !Utils.IsStringNumber(text);
			bool result;
			if (flag)
			{
				Utils.MessageBox("请输入数字");
				result = false;
			}
			else
			{
				bool flag2 = long.Parse(text) < 0L;
				if (flag2)
				{
					Utils.MessageBox("请输入正整数");
					result = false;
				}
				else
				{
					this.m_labelDef.m_strNo = text;
					this.m_labelDef.m_strPre = this.textPre.Text;
					this.m_labelDef.m_nPosType = this.comboPos.SelectedIndex;
					string itemText = this.comboViewType.GetItemText(this.comboViewType.Items[this.comboViewType.SelectedIndex]);
					this.m_labelDef.m_strTypeView = itemText;
					result = true;
				}
			}
			return result;
		}

		private void btnSingleContinue_Click(object sender, EventArgs e)
		{
			bool flag = !this.GetInfo();
			if (!flag)
			{
				this.m_labelDrawType = DlgHSLabelSet.Label_HS_Draw_Type.eDrawTypeContinueSingleSelect;
				base.Close();
				base.DialogResult = DialogResult.OK;
			}
		}

		private void btnMultiAuto_Click(object sender, EventArgs e)
		{
			bool flag = !this.GetInfo();
			if (!flag)
			{
				this.m_labelDrawType = DlgHSLabelSet.Label_HS_Draw_Type.eDrawTypeMultiSelectAuto;
				base.Close();
				base.DialogResult = DialogResult.OK;
			}
		}

		private void btnSetSameLabel_Click(object sender, EventArgs e)
		{
			bool flag = !this.GetInfo();
			if (!flag)
			{
				this.m_labelDrawType = DlgHSLabelSet.Label_HS_Draw_Type.eDrawTypeSetSameLabel;
				base.Close();
				base.DialogResult = DialogResult.OK;
			}
		}

		private void btnChangeSelect_Click(object sender, EventArgs e)
		{
			bool flag = !this.GetInfo();
			if (!flag)
			{
				this.m_labelDrawType = DlgHSLabelSet.Label_HS_Draw_Type.eDrawTypeChangeCurSel;
				base.Close();
				base.DialogResult = DialogResult.OK;
			}
		}

		private static int g_Dlg_X = 10;

		private static int g_Dlg_Y = 10;

		public DlgHSLabelSet.Label_HS_Draw_Type m_labelDrawType;

		public Label_Define m_labelDef = new Label_Define();

		public enum Label_HS_Draw_Type
		{
			eDrawTypeContinueSingleSelect,
			eDrawTypeMultiSelectAuto,
			eDrawTypeSetSameLabel,
			eDrawTypeChangeCurSel
		}
	}
}
